package com.common;

import com.fasterxml.jackson.databind.util.JSONPObject;
import org.apache.commons.lang3.StringUtils;


public class JSONPObjectUtil {

    public static final String CALL_BACK_PARAM_NAME = "callback";
    private static String CALL_BACK_PARAM_VALUE = "callBack";

    public static JSONPObject createJSONPObject(Object object) {
        CALL_BACK_PARAM_VALUE = "callBack";
        String callback = (String) ThreadLocalVarUtil.get(CALL_BACK_PARAM_NAME);
        if (StringUtils.isNotBlank(callback)) {
            CALL_BACK_PARAM_VALUE = callback;
        }
        return new JSONPObject(CALL_BACK_PARAM_VALUE, object);
    }

}